<?php
namespace app\data\controller;
use think\Db;
class Send
{
    public function _getdata_($chart='',$field='',$value='')//test::: http://localhost:88/tp5.1test/publ
    //ic/data/Data/_getdata_/chart/registration_form_of_atopic_dermatitis/field/name/value/%E5%B0%8F%E7%8E%8B
    {
        $data=Db::table($chart)->where($field,$value)->find();
        return json($data);
    }
    public function add()
    {
        if (IS_POST){
            $data=I('post.');
            json_encode($data,true);
            Db::name('ad')->insert($data);
        }
    }
    public function _insert_ad_(
            $Ad_number = '',
            $name = '',
            $Gender='',
            $nation='',
            $Age=0,
            $height=0.00,
            $weight=0.00,
            $BMI=0.00)
     {
        $data = [
            'Ad_numbe'=>$Ad_number ,
            'name'=>$name ,
            'Gender'=>$Gender,
            'nation'=>$nation,
            'Age'=>$Age,
            'height'=>$height,
            'weight'=>$weight,
            'BMI'=>$BMI
            ];
        Db::name('ad')->insert($data);
    }
    
    public function modify($chart,$id,$id_value,$field,$value_later)
    {
         $date=[
            $field =>$value_later
         ];
         Db::name($chart)->where($id,$id_value)->update($date);
    }
}
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

